<?php  
/* 
Template Name: Page Download
*/
?><?php get_header();?>
<div class="cy-content">
	<?php get_sidebar();?>
    <div class="cy-content-center">
    <?php locate_template('block/block-search.php', true); ?>
    <div class="cy-content-title">
    <h2><?php the_title();?></h2>
    </div><!--cy-content-title-->
    
    
       <div class="cy-download">
   <table width="100%" border="1" cellpadding="5" cellspacing="5">

  <tr class="cy-cy-download-top">
    <td width="274">Tên</td>
    <td width="84">Ngày</td>
    <td width="79">Xem</td>
      </tr>
      <?php
        		$paged = (get_query_var('page')) ? get_query_var('page') : 1;	
        		//query_posts('meta_key=_mf_write_panel_id&meta_value=1&');
        		$loop = new WP_Query(array('post_type'=>'download','orderby'=>'ASC','paged' => $paged));
   	?>
            <?php while ( $loop->have_posts() ) : $loop->the_post(); //bat dau vong lap ?>
      <tr class="cy-download-ngang">
        <td>
          <h2> <?php the_title()?><?php if(get_the_date('d')==date('d')) echo "<div class='cy-new'></div>";?></h2>      <span>
    </span></td>
        <td><span><?php echo get_the_date('d/m/Y');?></span></td>
        <td><span><?php $files= get_group('download_library');
                     // print_r($files);
                     foreach($files as $file){
                                   ?>
                                     <a href="<?php
                                    $fil=$file['file'];
                                    foreach($fil as $fi){
                                        echo $fi;
                                    }
                                     ?>"><?php
                                     
                                    $ten=$file['name'];
                                    foreach($ten as $te){
                                         //print_r($te['1']);
                                         echo $te;
                                    }
                                    ?></a><br />
                                   
                                     <?php
                                   }
        ?></span></td>
      </tr>
      	<?php endwhile; //ket thuc vong lap ?>
        <?php wp_reset_query();?>
    
    </table>
     </div><!--cy-download-->                            
    
</div><!--cy-content-center-->  
</div><!--cy-content-->
<?php get_footer(); ?>